<f:view xmlns:h="http://java.sun.com/jsf/html"
        xmlns:ui="http://java.sun.com/jsf/facelets"
        xmlns:fn="http://java.sun.com/jsp/jstl/functions"
        xmlns:g="http://code.google.com/p/ada-ado/generator"
        xmlns:f="http://java.sun.com/jsf/core"
        file="#{projectName}-applications.adb">-----------------------------------------------------------------------
--  #{projectName} -- #{projectName} applications
-----------------------------------------------------------------------
<ui:include src="../../licenses/license-ada.xhtml"/>
-----------------------------------------------------------------------
#{''}
with ADO.Drivers;
#{''}
with ASF.Applications;
with ASF.Applications.Main;
with ASF.Locales;
#{''}
#{''}
--  with #{fn:capitalize(projectName)}.XXX.Module;
package body #{fn:capitalize(projectName)}.Applications is
#{''}
   use AWA.Applications;
#{''}
   --  Initialize the application.
   procedure Initialize (App : in Application_Access) is
      Fact  : ASF.Applications.Main.Application_Factory;
      C     : ASF.Applications.Config;
   begin
      ADO.Drivers.Initialize;
#{''}
      C.Load_Properties ("#{projectName}.properties");
      App.Initialize (C, Fact);
#{''}
      App.Set_Global ("contextPath", "/#{projectName}");
#{''}
      --  Register the servlets and filters
      App.Add_Servlet (Name => "faces", Server => App.Faces'Access);
      App.Add_Servlet (Name => "files", Server => App.Files'Access);
      App.Add_Servlet (Name => "auth", Server => App.Auth'Access);
      App.Add_Servlet (Name => "verify-auth", Server => App.Verify_Auth'Access);
      App.Add_Servlet (Name => "perf", Server => App.Perf'Access);
      App.Add_Filter (Name => "dump", Filter => App.Dump'Access);
      App.Add_Filter (Name => "service", Filter => App.Service_Filter'Access);
      App.Add_Filter (Name => "perf", Filter => App.Perf'Access);
      App.Add_Filter (Name => "service", Filter => App.Service_Filter'Access);
#{''}
--      Register (App    => App.all'Access,
--                Name   => "XXX", URI => "XXX",
--                Module => App.XXX_Module'Access);
#{''}
      --  Define servlet mappings
      App.Add_Mapping (Name => "faces", Pattern => "*.html");
      App.Add_Mapping (Name => "files", Pattern => "*.css");
      App.Add_Mapping (Name => "files", Pattern => "*.js");
      App.Add_Mapping (Name => "files", Pattern => "*.png");
      App.Add_Mapping (Name => "files", Pattern => "*.jpg");
      App.Add_Mapping (Name => "verify-auth", Pattern => "/auth/verify");
      App.Add_Mapping (Name => "auth", Pattern => "/auth/auth/*");
      App.Add_Mapping (Name => "perf", Pattern => "statistics.xml");
#{''}
      App.Add_Filter_Mapping (Name => "perf", Pattern => "*.html");
      App.Add_Filter_Mapping (Name => "perf", Pattern => "*.css");
      App.Add_Filter_Mapping (Name => "perf", Pattern => "*.js");
      App.Add_Filter_Mapping (Name => "perf", Pattern => "*.png");
      App.Add_Filter_Mapping (Name => "perf", Pattern => "*.jpg");
#{''}
      App.Add_Filter_Mapping (Name => "dump", Pattern => "*.html");
      App.Add_Filter_Mapping (Name => "service", Pattern => "*.html");
      App.Add_Filter_Mapping (Name => "dump", Pattern => "*.css");
      App.Add_Filter_Mapping (Name => "dump", Pattern => "*.png");
      App.Add_Filter_Mapping (Name => "dump", Pattern => "*.jpg");
      App.Add_Filter_Mapping (Name => "dump", Pattern => "/auth/verify");
      App.Add_Filter_Mapping (Name => "dump", Pattern => "/auth/auth/*");
   end Initialize;
#{''}
end #{fn:capitalize(projectName)}.Applications;
</f:view>